<?php 
class Pics extends E_Entity 
{
	public   $table =array(
					"id" =>"id",
					"version" =>"version",
					"userid" =>"userid",
					"pic" =>"pic",
					"sign" =>"sign",
					"status" =>"status",
					"ctime" =>"ctime",
					"mtime" =>"mtime"
					);
					
	public function getTableName()
	{
		return "micro_pic";
	}
	public function getJoinMap()
	{
		$map = array();
		return $map;
	}
	public static function insertEntity($row)
	{	
		$entity = new self();
	 	return $entity->createEntityForRow($row);
	}
	public static function getById($id)
	{
		$entity = new self();
		$sql =  "select * from {$entity->getTableName()} where  {$entity->table['id']} = :id";
		return $entity->getEntityByIndexKey($sql, $id, array("id"=>$id));
	}
	public function getPic($size = '100X100')
	{
		$pic = $this->pic;
		if(!empty($pic))
		{
			$first_array = explode(".", $pic);
			return $first_array[0]."_$size.".$first_array[1];
			
		}	
		else
		{
			return '';
		}
	}
}
?>